package com.moxingzhegroup.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.moxingzhegroup.R;
import com.moxingzhegroup.base.BaseActivity;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author LiaoRun
 */
public class MessageActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_message);

        TextView textView = findViewById(R.id.text_text);
        TextView tickerView = findViewById(R.id.text_ticker);
        TextView titleView = findViewById(R.id.text_title);

        Intent intent = getIntent();

        String title = intent.getStringExtra("title");
        String text = intent.getStringExtra("text");
        String ticker = intent.getStringExtra("ticker");
        int duration = intent.getIntExtra("duration", 10);

        textView.setText(text);
        titleView.setText(title);
        tickerView.setText(ticker);


        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                // 完成返回上一级
                finish();
            }
        }, duration);
    }

}
